#include "Menu.h"

void Menu(int& entry)
{
	// Insert modes here and modify entries permitted
	std::cout << "1. Play game with 3 players." << std::endl;
	std::cout << "2. Leave." << std::endl;

	// Call the input function to enter a choice
	Input(entry);
	Choice(entry);
}

void Choice(int& entry)
{
	if (entry == ONE)
	{
		septdc sv;
		// Plays the game
		Play(sv);
	}
	else if (entry == TWO)
	{
		// Leave game
		std::cout << "Have a nice day!" << std::endl;
	}
	else
	{
		// Input is outside of acceptable parameters and user is asked to try again
		std::cout << "Invalid Choice" << std::endl;
		Menu(entry);
	}
}

int ChooseCard(const hand& h)
{
	// Choose a card from the player's hand
	char chosenCard;
	int temp;
	do
	{
		std::cout << "Please select a card from your hand: "; std::cin >> chosenCard;
		temp = LettertoNumber(chosenCard);
		if (temp > h.nbCardInHand)
		{
			std::cout << "You grasp at thin air and find no card there." << std::endl;
		}
	} while (temp > h.nbCardInHand);
	// Returns the value of temp (which is an int)
	return temp;
}

int LettertoNumber(char convert)
{
	// If the entered char (taken through parameter) is between the value of A and G
	if (convert >= 'A' && convert <= 'Z')
	{
		// Converts the value of the item to itself minus the value of A
		convert = convert - 'A';
	}
	// If the value of the entered char is between lowercase a and lowercase g	
	else if (convert >= 'a' && convert <= 'z')
	{
		// Converts the value of the item to itself minus the value of a
		convert = convert - 'a';
	}
	// Returns the value of the item, which is now an int
	return convert;
}